<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{$config.sitetitle}|{$config.sitetitle2}</title>
<link rel="stylesheet" href="__TMPL__/jmobile/jquery.mobile-1.3.0.min.css" />
<link rel="stylesheet" href="__TMPL__/css/page.css" />
<script src="__TMPL__/jmobile/jquery.min.js"></script>
<script src="__TMPL__/jmobile/jquery.mobile-1.3.0.min.js"></script>
<script src="__TMPL__/jmobile/jquery.nicescroll.js"></script>
<style>
a{text-decoration:none;}
.ui-content img {
max-width:100%;}
</style>
<script>
  $(document).ready(function() {
    $("html").niceScroll({  cursorwidth:4 });  // The document page (html)
  });
</script>
</head>
<body >

<div data-role="page" id="news">
		<div data-role="header">
		<a href="#"  data-transition="slidefade" class="ui-btn-right ui-btn ui-shadow ui-corner-all ui-icon-back ui-btn-icon-notext" data-theme="a" data-rel="back"></a>
		<h1>{$type.typename}</h1>
		<a href="__ROOT__/"  data-direction="reverse" class="ui-btn-left ui-btn ui-shadow ui-corner-all ui-icon-home ui-btn-icon-notext" data-ajax="false"></a>
	</div><!-- /header -->
	<div data-role="content" >
		
<div id="wrapper">
<h1><notempty name="article.titlecolor"><font color="{$article.titlecolor}"></notempty>{$article.title}<present name="nowpage">({$nowpage})</present><notempty name="article.titlecolor"></font></notempty></h1>
<p align="center"><img src="__ROOT__{$article.imgurl}" border="0"  style="max-width:305px; max-height:260px;"  id="product_pic"></p>
<p>{$article.description}</p>
<p>{$article.content}</p>
<p>价格:<font color="#F00"><b>{$article.price}</b></font>元</p>
<p><eq name='config.istrade' value='1'>
<!--有多个颜色或型号请写JS将其赋值到隐藏域型号中-->
订购数量：<input type="range" name="slider-1" min="0" max="100" value="1" id="gnum" />
<input name="gid" id="gid" type="hidden" value="{$article.aid}" />
<input name="gname" id="gname" type="hidden" value="{$article.title}" />
<input name="gprice" id="gprice" type="hidden" value="{$article.price}" />
<input name="servial" id="servial" type="hidden" value="{$article.color}" />
<div style="margin:5px;"><input type="button" class="buy_btn" id="go_buy" value="立即购买" data-icon="forward" data-theme="b" />&nbsp;<input type="button" class="Q-buy-btn cart_btn" id="add_cart" value="加入购物车" data-icon="grid" data-theme="e"/></div>
<!--J-shoping-->
<div class="J-shoping J-shoping-small">
	<div class="J-shoping-item">
		<div class="baseBg J-L-ico J-shoping-pos"></div>
		<div class="J-shoping-main">
			<div class="J-shoping-title">
				<a href="#" title="" class="J-go"><em class="baseBg"></em>购物车</a>
				<span class="baseBg J-shoping-num">0</span>
			</div>
			<div class="baseBg J-shoping-mx"></div>
			<div class="J-shoping-px"></div>
			<div class="J-shoping-body">
				<div class="J-shoping-buy">
					<a class="baseBg" href="__ROOT__/index.php?m=Member&a=gobuy&iscart=1" title="去购物车结算"></a>
				</div>
			</div>
		</div>
		<div class="baseBg J-R-ico J-shoping-pos"></div>
	</div>
</div>

<link href="__TMPL__/css/shopping.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="__PUBLIC__/js/jQuery-shopping.js"></script>
<script type="text/javascript" >
var url_root = '__ROOT__';
//初始化购物车
function cart_init(){
$.getJSON("__ROOT__/index.php?m=Public&a=ajax_cart_list",{},function(ret){
	var data = ret.data;
	var num=0;		
$.each(data,function(key,val) {
	if(typeof(val.name) != "undefined"){
	num++;
	if(typeof(val.option.pic) != "undefined" && val.option.pic !=''){var pic=val.option.pic;}else{var pic='__ROOT__/Public/image/nopic.gif';}
	$('.J-shoping-body').prepend('<div class="J-shoping-list" data-id="'+val.id+'"><a href="#" title=""><img src="' + pic + '" width="50"height="50"/></a><div class="J-shoping-list-a"><p>' + val.name + '【' + val.qty + '件】</p><p><span class="left">'+ val.option.gtype + '</span><span class="right"><em>' + val.price + '</em>元</span></p></div><div class="baseBg J-shoping-close"></div></div>');		
	};
	$('.J-shoping-num').text(num);
	
  });
  });
}
//添加到购物车
function addto_cart(){
var id = $('#gid').val();
var name=$('#gname').val();
var qty= $('#gnum').val();
var price= $('#gprice').val();
var gtype= $('#servial').val();
var pic = $('#product_pic').attr('src');
$.post("__ROOT__/index.php?m=Public&a=ajax_insert_cart",{id:id,name:name,qty:qty,price:price,gtype:gtype,pic:pic},function(result){
    //alert(result);
  });
}
$(function(){
cart_init();
$('.Q-buy-btn').shoping(); //调用shoping函数
$('.Q-buy-btn').click(function(){
addto_cart();	
})
$('#go_buy').click(function(){
var id = $('#gid').val();
var name=$('#gname').val();
var qty= $('#gnum').val();
var price= $('#gprice').val();
var gtype= $('#servial').val();
var pic = $('#product_pic').attr('src');
location.href="__ROOT__/index.php?m=Member&a=gobuy&iscart=0&id="+id+"&name="+name+"&qty="+qty+"&price="+price+"&gtype="+gtype+"&pic="+pic;
})
});
</script>
</eq>
</p>
    <neq name="lastpage" value=""><div class="ui-bar ui-bar-a ui-corner-all" data-icon="arrow-l" data-theme="a" data-iconpos="left">{$lastpage}</div></neq>
    <neq name="nextpage" value=""><div class="ui-bar ui-bar-a ui-corner-all" data-icon="arrow-r" data-theme="a" data-iconpos="left">{$nextpage}</div></neq>

<p></p>
</div>
	</div><!-- /content -->	
</div><!-- /page -->
</body>
</html>
